//
//  Matrix4x4.h
//  TrackingSim
//
//  Created by Garrett Manka on 12/31/11.
//  Copyright (c) 2011. All rights reserved.
//

#ifndef TrackingSim_Matrix4x4_h
#define TrackingSim_Matrix4x4_h

class Matrix4x4
{
public:
    double m[4][4];
	double m_trans[4][4];
    
public:
    
    Matrix4x4(){};
    
    Matrix4x4(double m11, double m12, double m13, double m14,
              double m21, double m22, double m23, double m24,
              double m31, double m32, double m33, double m34,
              double m41, double m42, double m43, double m44)
    {
        
        m[0][0] = m11; m[0][1] = m12; m[0][2] = m13; m[0][3] = m14;
        m[1][0] = m21; m[1][1] = m22; m[1][2] = m23; m[1][3] = m24;
        m[2][0] = m31; m[2][1] = m32; m[2][2] = m33; m[2][3] = m34;
        m[3][0] = m41; m[3][1] = m42; m[3][2] = m43; m[3][3] = m44;
    }
    
    double& operator()(int i , int j);
    
    inline void setTransX(double x){ m[3][0] = x; }
    inline void setTransY(double y){ m[3][1] = y; }
    inline void setTransZ(double z){ m[3][2] = z; }
    
    inline void m11( double _m11 ){ m[0][0] = _m11; }
    inline void m22( double _m22 ){ m[1][1] = _m22; }
    inline void m33( double _m33 ){ m[2][2] = _m33; }
    
    const double* mat() const { return &m[0][0]; }

	const double* mat_trans();
};

Matrix4x4 operator*(const Matrix4x4& a, const Matrix4x4& b);

#endif
